// 清除浮动
@mixin clearfix {
  &:after {
    content: "";
    display: table;
    clear: both;
  }
}

// 多行隐藏
@mixin textOverflow($clamp:1) {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  -o-text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: $clamp;
  /*! autoprefixer: ignore next */
  -webkit-box-orient: vertical;
}

//flex box
@mixin flexbox($jc:space-between, $ai:center, $fd:row, $fw:nowrap) {
  display: flex;
  display: -webkit-flex;
  flex: 1;
  justify-content: $jc;
  -webkit-justify-content: $jc;
  align-items: $ai;
  -webkit-align-items: $ai;
  flex-direction: $fd;
  -webkit-flex-direction: $fd;
  flex-wrap: $fw;
  -webkit-flex-wrap: $fw;
}

/*
  $width 宽度
  $height 高度
  $deg 流光宽度大小
  $step 速度快慢
  $border 流光边框展示宽度
  $bdBgC 边框底色
  $smC 流光颜色
  $aBgC 盒子背景
  $br 内圆角值
 */
@mixin streamer($width: 100px, $height: 300px, $deg: 20%, $step: 2s, $border: 4px, $bdBgC: #1a232a, $smC: #A8EFFFFF, $aBgC: #000, $br: 5px) {
  position: relative;
  z-index: 0;
  width: $width;
  height: $height;
  overflow: hidden;

  &::before {
    content: '';
    position: absolute;
    z-index: -2;
    @if ($width > $height) {
      width: $width * 2;
      height: $width * 2;
      top: calc(($height - ($width * 2)) / 2);
      left: calc(-($width / 2));
    } @else {
      width: $height * 2;
      height: $height * 2;
      left: calc(($width - ($height * 2)) / 2);
      top: - calc($height / 2);
    }
    background-color: $bdBgC;
    background-repeat: no-repeat;
    background-position: 0 0;
    background-image: conic-gradient(transparent, $smC, transparent $deg);
    animation: rotate $step linear infinite;
  }

  &::after {
    content: '';
    position: absolute;
    z-index: -1;
    left: $border;
    top: $border;
    width: calc(100% - $border * 2);
    height: calc(100% - $border * 2);
    background: $aBgC;
    border-radius: $br;
  }
}

@keyframes rotate {
  100% {
    transform: rotate(1turn);
  }
}
